﻿@model Source.ViewModels.CartShop
         
@{
    ViewBag.Title = "Index";
}
<script type="text/javascript">

    function isNumberKey(evt) {

        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        }
        return true;
    }
  </script>
@if(Model.ds_cart.Count == 0)
{
    <span style="color:#E9DA95;
	padding-left:30px;
	background-image:url('../../Images/Common/nensf.png');
	font-size:20px;display:block"> Giỏ Hàng Còn Trống</span>
    
    <a href="../">Xin hãy chọn sản phẩm để mua</a>    
}
else
{
    <span style="color:#E9DA95;
	padding-left:30px;
	background-image:url('../../Images/Common/nensf.png');
	font-size:20px;display:block"> Giỏ Hàng</span>
    <table width="100%" style="margin-top:30px; border:1px solid;-moz-border-radius: 15px; color:#E9DA95;border-radius: 15px; ">
        <tr>
            <th style="border-bottom:1px solid;border-right:1px solid">Hình</th>
            <th style="border-bottom:1px solid;border-right:1px solid">Số lượng</th>
            <th style="border-bottom:1px solid;border-right:1px solid">Giá Tiền</th>
            <th style="border-bottom:1px solid;border-right:1px solid"><a href="#" style="color:#E9DA95"> </a></th>
            <th style="border-bottom:1px solid"><a href="#" style="color:#E9DA95"> </a></th>
        </tr>

    @foreach (Source.ViewModels.CartLine cartline in Model.ds_cart)
    {
        <tr>

            <th style="border-bottom:1px solid;border-right:1px solid"><img src="data:image/jpg;base64,@(Convert.ToBase64String(cartline.sp.HinhAnh))" style="border-style: solid;
    border-color: #643112;
    border-width: 6px;
    position: relative;" height="120px" width="120px"  alt="" /></th>
            <th style="border-bottom:1px solid;border-right:1px solid"><input type="text" onkeypress="return isNumberKey(event)" value="@cartline.SL" style="width:30px"/></th>
            <th style="border-bottom:1px solid;border-right:1px solid">@cartline.Gia</th>
            <th style="border-bottom:1px solid;border-right:1px solid">@Html.ActionLink("Xóa", "removeToCart", new { controller = "Cart", MaSP = cartline.sp.MaSP })</th>   
            <th style="border-bottom:1px solid">@Html.ActionLink("Thêm", "addQuantity", new { controller = "Cart", MaSP = cartline.sp.MaSP })</th>   
        </tr>
    }
       <tr>
            <th colspan="5"><h3 style="background-color: #E9DA95;"><b>Thành Tiền: @Model.total</b></h3> </th>
       </tr>
         <tr>
            <th colspan="5"><h3 style="background-color: #E9DA95;"><b>Tổng Tiền: @Model.total</b></h3>  </th>
       </tr>
    </table>
    <div style="text-align:center">
    <a href="../"><input id="muatiep" type="button" value="Mua Tiếp" style="background-color: #E9DA95;color: #8A4A22;" /></a>
    <a><input id="Đathang" type="button" value="Đặt Hàng" style="background-color: #E9DA95;color: #8A4A22;" /></a>
    </div>
}